﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout1.cshtml";
    bool lang = (bool)ViewData["lang"];
}
<script src="/Scripts/maplib.js" type="text/javascript"></script>
<input type="hidden" id="cthlang" value="@lang.ToString()" />
<div class="tebox">
    <div class="contact">
        <ul>
            <li>
                <p>CÔNG TY CỔ PHẦN KỸ THUẬT PHƯƠNG NAM</p>
            </li>
            <li>
                <ul>
                    <li>
                        <p>Địa chỉ</p>
                        <span>:&nbsp;&nbsp;Tòa nhà SISC- Số 27-29-31, Đường 9A, KDC Trung Sơn, Khu ĐTM Nam Sài Gòn, Huyện Bình Chánh, TP.HCM</span></li>
                    <li>
                        <p>Điện thoại</p>
                        <span>:&nbsp;&nbsp;08 – 54310668</span></li>                   
                    <li>
                        <p>Hotline</p>
                        <span>:&nbsp;&nbsp;0903644504 (Quản lý sản xuất)</span></li>
                    <li>
                        <p>Website</p>
                        <span>:&nbsp;&nbsp;www.pntech.com.vn</span></li>
                    <li>
                        <p>Email</p>
                        <span>:&nbsp;&nbsp;info@pntech.com.vn</span></li>
                </ul>
            </li>
        </ul>
    </div>
    <!--contact-->
    <div class="guimail">
        <ul>
            <li>
                <p>Liên hệ với hệ thống CÔNG TY CỔ PHẦN KỸ THUẬT PHƯƠNG NAM qua Email</p>
            </li>
            <li>
                <span style="margin-top: 10px; text-align:justify;">Cảm ơn Quý khách đã dành thời gian liên hệ, góp ý với chúng tôi. Vui lòng điền đầy đủ những thông tin dưới đây (bao gồm cả thông tin cá nhân để chúng tôi tiện liên lạc khi cần thiết) sau đó bấm vào nút Gửi.
Chúng tôi sẽ liên lạc với quý khách trong thời gian sớm nhất. Mọi thông tin cá nhân của quý khách sẽ được giữ bí mật hoàn toàn.</span></br>
                                    <span style="font-size: 11px;">Những ô bắt buộc phải điền với dấu ghi chú hoa thị&nbsp;<span style="color: red;">(*)</span></span>
            </li>
        </ul>
        <div class="form-dk">
            <ul>
                <li>
                    <p>Họ và Tên:<span>*</span></p>
                        <input id="name" type="text" name="name" style="width: 300px; height: 20px; float: left; border:1px solid #FF6600" />
                </li>
                <li id="li_nuoc">
                    <p>Quốc gia:</p>
                        <select id="s_nuoc" style="width: 302px; height: 23px; float: left; border:1px solid #FF6600" >
                            <option value="AF">Afghanistan 
                            <option value="AL">Albania 
                            <option value="DZ">Algeria 
                            <option value="AS">American Samoa
                            <option value="AD">Andorra 
                            <option value="AO">Angola
                            <option value="AI">Anguilla
                            <option value="AQ">Antarctica
                            <option value="AG">Antigua and Barbuda 
                            <option value="AR">Argentina 
                            <option value="AM">Armenia 
                            <option value="AW">Aruba 
                            <option value="AU">Australia 
                            <option value="AT">Austria 
                            <option value="AZ">Azerbaijan
                            <option value="BS">Bahamas 
                            <option value="BH">Bahrain 
                            <option value="BD">Bangladesh
                            <option value="BB">Barbados
                            <option value="BY">Belarus 
                            <option value="BE">Belgium 
                            <option value="BZ">Belize
                            <option value="BJ">Benin 
                            <option value="BM">Bermuda 
                            <option value="BT">Bhutan
                            <option value="BO">Bolivia 
                            <option value="BA">Bosnia and Herzegowina
                            <option value="BW">Botswana
                            <option value="BV">Bouvet Island 
                            <option value="BR">Brazil
                            <option value="IO">British Indian Ocean Territory
                            <option value="BN">Brunei Darussalam 
                            <option value="BG">Bulgaria
                            <option value="BF">Burkina Faso
                            <option value="BI">Burundi 
                            <option value="KH">Cambodia
                            <option value="CM">Cameroon
                            <option value="CA">Canada
                            <option value="CV">Cape Verde
                            <option value="KY">Cayman Islands
                            <option value="CF">Central African Republic
                            <option value="TD">Chad
                            <option value="CL">Chile 
                            <option value="CN">China 
                            <option value="CX">Christmas Island
                            <option value="CC">Cocos (Keeling) Islands 
                            <option value="CO">Colombia
                            <option value="KM">Comoros 
                            <option value="CG">Congo 
                            <option value="CD">Congo, the Democratic Republic of the 
                            <option value="CK">Cook Islands
                            <option value="CR">Costa Rica
                            <option value="CI">Cote d'Ivoire 
                            <option value="HR">Croatia (Hrvatska)
                            <option value="CU">Cuba
                            <option value="CY">Cyprus
                            <option value="CZ">Czech Republic
                            <option value="DK">Denmark 
                            <option value="DJ">Djibouti
                            <option value="DM">Dominica
                            <option value="DO">Dominican Republic
                            <option value="TP">East Timor
                            <option value="EC">Ecuador 
                            <option value="EG">Egypt 
                            <option value="SV">El Salvador 
                            <option value="GQ">Equatorial Guinea 
                            <option value="ER">Eritrea 
                            <option value="EE">Estonia 
                            <option value="ET">Ethiopia
                            <option value="FK">Falkland Islands (Malvinas) 
                            <option value="FO">Faroe Islands 
                            <option value="FJ">Fiji
                            <option value="FI">Finland 
                            <option value="FR">France
                            <option value="FX">France, Metropolitan
                            <option value="GF">French Guiana 
                            <option value="PF">French Polynesia
                            <option value="TF">French Southern Territories 
                            <option value="GA">Gabon 
                            <option value="GM">Gambia
                            <option value="GE">Georgia 
                            <option value="DE">Germany 
                            <option value="GH">Ghana 
                            <option value="GI">Gibraltar 
                            <option value="GR">Greece
                            <option value="GL">Greenland 
                            <option value="GD">Grenada 
                            <option value="GP">Guadeloupe
                            <option value="GU">Guam
                            <option value="GT">Guatemala 
                            <option value="GN">Guinea
                            <option value="GW">Guinea-Bissau 
                            <option value="GY">Guyana
                            <option value="HT">Haiti 
                            <option value="HM">Heard and Mc Donald Islands 
                            <option value="VA">Holy See (Vatican City State) 
                            <option value="HN">Honduras
                            <option value="HK">Hong Kong 
                            <option value="HU">Hungary 
                            <option value="IS">Iceland 
                            <option value="IN">India 
                            <option value="ID">Indonesia 
                            <option value="IR">Iran (Islamic Republic of)
                            <option value="IQ">Iraq
                            <option value="IE">Ireland 
                            <option value="IL">Israel
                            <option value="IT">Italy 
                            <option value="JM">Jamaica 
                            <option value="JP">Japan 
                            <option value="JO">Jordan
                            <option value="KZ">Kazakhstan
                            <option value="KE">Kenya 
                            <option value="KI">Kiribati
                            <option value="KP">Korea, Democratic People's Republic of
                            <option value="KR">Korea, Republic of
                            <option value="KW">Kuwait
                            <option value="KG">Kyrgyzstan
                            <option value="LA">Lao People's Democratic Republic
                            <option value="LV">Latvia
                            <option value="LB">Lebanon 
                            <option value="LS">Lesotho 
                            <option value="LR">Liberia 
                            <option value="LY">Libyan Arab Jamahiriya
                            <option value="LI">Liechtenstein 
                            <option value="LT">Lithuania 
                            <option value="LU">Luxembourg
                            <option value="MO">Macau 
                            <option value="MK">Macedonia, The Former Yugoslav Republic of
                            <option value="MG">Madagascar
                            <option value="MW">Malawi
                            <option value="MY">Malaysia
                            <option value="MV">Maldives
                            <option value="ML">Mali
                            <option value="MT">Malta 
                            <option value="MH">Marshall Islands
                            <option value="MQ">Martinique
                            <option value="MR">Mauritania
                            <option value="MU">Mauritius 
                            <option value="YT">Mayotte 
                            <option value="MX">Mexico
                            <option value="FM">Micronesia, Federated States of 
                            <option value="MD">Moldova, Republic of
                            <option value="MC">Monaco
                            <option value="MN">Mongolia
                            <option value="MS">Montserrat
                            <option value="MA">Morocco 
                            <option value="MZ">Mozambique
                            <option value="MM">Myanmar 
                            <option value="NA">Namibia 
                            <option value="NR">Nauru 
                            <option value="NP">Nepal 
                            <option value="NL">Netherlands 
                            <option value="AN">Netherlands Antilles
                            <option value="NC">New Caledonia 
                            <option value="NZ">New Zealand 
                            <option value="NI">Nicaragua 
                            <option value="NE">Niger 
                            <option value="NG">Nigeria 
                            <option value="NU">Niue
                            <option value="NF">Norfolk Island
                            <option value="MP">Northern Mariana Islands
                            <option value="NO">Norway
                            <option value="OM">Oman
                            <option value="PK">Pakistan
                            <option value="PW">Palau 
                            <option value="PA">Panama
                            <option value="PG">Papua New Guinea
                            <option value="PY">Paraguay
                            <option value="PE">Peru
                            <option value="PH">Philippines 
                            <option value="PN">Pitcairn
                            <option value="PL">Poland
                            <option value="PT">Portugal
                            <option value="PR">Puerto Rico 
                            <option value="QA">Qatar 
                            <option value="RE">Reunion 
                            <option value="RO">Romania 
                            <option value="RU">Russian Federation
                            <option value="RW">Rwanda
                            <option value="KN">Saint Kitts and Nevis 
                            <option value="LC">Saint LUCIA 
                            <option value="VC">Saint Vincent and the Grenadines
                            <option value="WS">Samoa 
                            <option value="SM">San Marino
                            <option value="ST">Sao Tome and Principe 
                            <option value="SA">Saudi Arabia
                            <option value="SN">Senegal 
                            <option value="SC">Seychelles
                            <option value="SL">Sierra Leone
                            <option value="SG">Singapore 
                            <option value="SK">Slovakia (Slovak Republic)
                            <option value="SI">Slovenia
                            <option value="SB">Solomon Islands 
                            <option value="SO">Somalia 
                            <option value="ZA">South Africa
                            <option value="GS">South Georgia and the South Sandwich Islands
                            <option value="ES">Spain 
                            <option value="LK">Sri Lanka 
                            <option value="SH">St. Helena
                            <option value="PM">St. Pierre and Miquelon 
                            <option value="SD">Sudan 
                            <option value="SR">Suriname
                            <option value="SJ">Svalbard and Jan Mayen Islands
                            <option value="SZ">Swaziland 
                            <option value="SE">Sweden
                            <option value="CH">Switzerland 
                            <option value="SY">Syrian Arab Republic
                            <option value="TW">Taiwan, Province of China 
                            <option value="TJ">Tajikistan
                            <option value="TZ">Tanzania, United Republic of
                            <option value="TH">Thailand
                            <option value="TG">Togo
                            <option value="TK">Tokelau 
                            <option value="TO">Tonga 
                            <option value="TT">Trinidad and Tobago 
                            <option value="TN">Tunisia 
                            <option value="TR">Turkey
                            <option value="TM">Turkmenistan
                            <option value="TC">Turks and Caicos Islands
                            <option value="TV">Tuvalu
                            <option value="UG">Uganda
                            <option value="UA">Ukraine 
                            <option value="AE">United Arab Emirates
                            <option value="GB">United Kingdom
                            <option value="US">United States 
                            <option value="UM">United States Minor Outlying Islands
                            <option value="UY">Uruguay 
                            <option value="UZ">Uzbekistan
                            <option value="VU">Vanuatu 
                            <option value="VE">Venezuela 
                            <option value="VN">Viet Nam
                            <option value="VG">Virgin Islands (British)
                            <option value="VI">Virgin Islands (U.S.) 
                            <option value="WF">Wallis and Futuna Islands 
                            <option value="EH">Western Sahara
                            <option value="YE">Yemen 
                            <option value="YU">Yugoslavia
                            <option value="ZM">Zambia
                            <option value="ZW">Zimbabwe
                        </select>
                </li>
                <li id="li_tinh">
                    <p>Tỉnh/Thành phố</p>
                        <select id="s_tinh" style="width: 302px; height: 23px; float: left; border:1px solid #FF6600" >
                        <option value="0">[Chọn tỉnh]</option><option value="1">An Giang</option><option value="2">Bà Rịa - Vũng Tàu</option><option value="3">Bắc Giang</option><option value="4">Bắc Kạn</option><option value="5">Bạc Liêu</option><option value="6">Bắc Ninh</option><option value="7">Bến Tre</option><option value="8">Bình Định</option><option value="9">Bình Dương</option><option value="10">Bình Phước</option><option value="11">Bình Thuận</option><option value="12">Cà Mau</option><option value="14">Cần Thơ</option><option value="13">Cao Bằng</option><option value="15">Đà Nẵng</option><option value="16">Đắk Lắk</option><option value="17">Đắk Nông</option><option value="18">Điện Biên</option><option value="19">Đồng Nai</option><option value="20">Đồng Tháp</option><option value="63">Gia Lai</option><option value="23">Hà Giang</option><option value="24">Hà Nam</option><option value="22">Hà Nội</option><option value="25">Hà Tĩnh</option><option value="26">Hải Dương</option><option value="21">Hải Phòng</option><option value="27">Hậu Giang</option><option value="28">Hòa Bình</option><option value="30">Hưng Yên</option><option value="31">Khánh Hòa</option><option value="32">Kiên Giang</option><option value="33">Kon Tum</option><option value="34">Lai Châu</option><option value="35">Lâm Đồng</option><option value="36">Lạng Sơn</option><option value="37">Lào Cai</option><option value="38">Long An</option><option value="39">Nam Định</option><option value="40">Nghệ An</option><option value="41">Ninh Bình</option><option value="42">Ninh Thuận</option><option value="43">Phú Thọ</option><option value="44">Phú Yên</option><option value="45">Quảng Bình</option><option value="46">Quảng Nam</option><option value="47">Quảng Ngãi</option><option value="48">Quảng Ninh</option><option value="49">Quảng Trị</option><option value="50">Sóc Trăng</option><option value="51">Sơn La</option><option value="52">Tây Ninh</option><option value="53">Thái Bình</option><option value="54">Thái Nguyên</option><option value="55">Thanh Hóa</option><option value="56">Thừa Thiên Huế</option><option value="57">Tiền Giang</option><option value="29">TP HCM</option><option value="58">Trà Vinh</option><option value="59">Tuyên Quang</option><option value="60">Vĩnh Long</option><option value="61">Vĩnh Phúc</option><option value="62">Yên Bái</option>
                        </select>
                </li>
                <li>
                    <p>Địa chỉ:</p>
                    
                        <input id="address" type="text" name="add" style="width: 300px; height: 20px; float: left; border:1px solid blue" />
                    
                </li>
                <li>
                    <p>Địa chỉ Email:<span>*</span></p>
                    
                        <input id="email" type="text" name="mail" style="width: 300px; height: 20px; float: left; border:1px solid #FF6600" />
                    
                </li>
                <li>
                    <p>Số điện thoại liên hệ:</p>
                    
                        <input id="phone" type="text" name="phone" style="width: 300px; height: 20px; float: left; border:1px solid blue" />
                    
                </li>
                <li>
                    <p>Tiêu đề:<span>*</span></p>
                    
                        <input id="cttitle" type="text" name="mail" style="width: 300px; height: 20px; float: left; border:1px solid #FF6600" />
                    
                </li>
                <li>
                    <p>Nội dung:<span>*</span></p>
                    
                        <textarea id="message" name="message" rows="4" id="message" cols="" style="width: 300px; height: 100px; float: left; border:1px solid #FF6600"></textarea>
                    
                </li>
                <li>
                    <input id="send" type="button" value="Gửi đi" style="float: right; margin-right: 254px; cursor:pointer; margin-top: 10px; padding: 5px 15px; background: #999; border-top: 2px solid white; border-left: 2px solid white; border-bottom: 2px solid ##666; border-right: 2px solid #666; color: white; font-size: 11px; font-weight: bold; margin-bottom: 10px" />
                </li>
            </ul>
        </div>
        <!--form-dk-->
    </div>
    <!--guimail-->
    <div class="maps">
        <ul>
            <li>
                @if (lang)
                {
                     <p>Bản đồ địa điểm trụ sở CÔNG TY CỔ PHẦN KỸ THUẬT PHƯƠNG NAM</p>
                }
                else
                {
                    <p>Map for Phuong Nam's office location</p>
                }
               
            </li>
            <li>
                <div id="divMap" style="position:relative; width:715px; height:603px;"></div></li>
        </ul>
    </div>
    <!--maps-->
</div>

<script src="/Scripts/callscript.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".titlesub p").empty();
        var lang = document.URL.indexOf("en-US") < 0 ? true : false;
        if (lang) {
            $(".titlesub p").append("Liên hệ");
            $("#ulink_home a").append("Trang chủ");
            $("#ulink_child a").append("Liên hệ");
            $("#ulink_child a").attr("href", "/contact");
        }
        else {
            $(".titlesub p").append("Contact");
            $("#ulink_home a").append("Home");
            $("#ulink_home a").attr("href", "/en-US/home");
            $("#ulink_child a").append("Contact");
            $("#ulink_child a").attr("href", "/en-US/contact");
        }
        function addCircle(map, location, radius, setview) {
            try {
                var R = 6371; // earth's mean radius in km
                var lat = (location.latitude * Math.PI) / 180; //rad
                var lon = (location.longitude * Math.PI) / 180; //rad
                var d = parseFloat(radius) / R; // d = angular distance covered on earth's surface
                circlePoints = new Array();
                for (x = 0; x <= 360; x++) {
                    var p2 = new Microsoft.Maps.Location(0, 0);
                    brng = x * Math.PI / 180; //rad
                    p2.latitude = Math.asin(Math.sin(lat) * Math.cos(d) + Math.cos(lat) * Math.sin(d) * Math.cos(brng));
                    p2.longitude = ((lon + Math.atan2(Math.sin(brng) * Math.sin(d) * Math.cos(lat), Math.cos(d) - Math.sin(lat) * Math.sin(p2.latitude))) * 180) / Math.PI;
                    p2.latitude = (p2.latitude * 180) / Math.PI;
                    circlePoints.push(p2);
                }

                var polygoncolor = new Microsoft.Maps.Color(100, 100, 0, 100);
                var polygon = new Microsoft.Maps.Polygon(circlePoints, { fillColor: polygoncolor, strokeColor: polygoncolor });

                // Add the polygon to the map
                map.entities.push(polygon);

                // Center the map on the location
                var setzoom;
                switch (radius) {
                    case "0.5":
                        {
                            setzoom = 15;
                            break;
                        }
                    case "1":
                        {
                            setzoom = 14;
                            break;
                        }
                    case "3":
                        {
                            setzoom = 13;
                            break;
                        }
                    case "5":
                        {
                            setzoom = 12;
                            break;
                        }
                    case "10":
                        {
                            setzoom = 11;
                            break;
                        }
                    case "50":
                        {
                            setzoom = 9;
                            break;
                        }
                }
                if (!setview)
                    map.setView({ center: new Microsoft.Maps.Location(location.latitude, location.longitude), zoom: setzoom });

            } catch (e) {
                // Catch any errors
                alert("Broken = " + e);
            }
        }


        var map = new Microsoft.Maps.Map(document.getElementById("divMap"),
                                  {
                                      credentials: "AvOW5Fz4QTsubTTdmaVnseeZnAQ0JYwbx_6zdMdgHk6iF-pnoTE7vojUFJ1kXFTP",
                                      center: new Microsoft.Maps.Location(10.738670, 106.689893),
                                      mapTypeId: Microsoft.Maps.MapTypeId.road,
                                      showMapTypeSelector: false,
                                      showDashboard: false,
                                      zoom: 16
                                  });


                                  var pin = new Microsoft.Maps.Pushpin({ latitude: 10.738670, longitude: 106.689893 }, {
            icon: "/Images/center_pin.png",
            anchor: new Microsoft.Maps.Point(10, 8),
            height: 24,
            width: 24
        });
        map.entities.push(pin);
        addCircle(map, new Microsoft.Maps.Location(10.738670, 106.689893), 0.5, null);


        $(s_nuoc).val("VN");
        $(s_nuoc).change(function () {
            if ($(s_nuoc).val() == "VN") {
                $(li_tinh).css("display", "block");
                $(s_tinh).val("0");
            }
            else {
                $(li_tinh).css("display", "none");
                $(li_tinh).val("0");
            }
        });

        $(send).click(function () {
            var lang = $("#cthlang").val() == "True" ? "vn" : "en";
            var vname = $("#name").val();
            var vtitle = $("#cttitle").val();
            var vnuoc = $("#s_nuoc option:selected").text();
            var valuenuoc = $(s_nuoc).val();
            var vtinh = $("#s_tinh option:selected").text();
            var valuetinh = $(s_tinh).val();
            var vadd = $(address).val();
            var vmail = $(email).val();
            var vmess = $(message).val();
            var vphone = $(phone).val();
            var flag = "t";
            if (valuenuoc === "VN") {
                if (valuetinh == "0")
                    flag = "f";
                else
                    flag = "t";
            }
            else {
                vtinh = "";
            }
            if (!validateEmail(vmail)) {
                if(lang=="vn")
                    alert("Email không hợp lệ");
                else
                    alert("Email address invalid");
            }
            else {
                if (vname == "" || flag == "f" || vmail == "" || vmess == "" || vtitle == "") {
                    if (lang == "vn")
                        alert("Bạn phải cung cấp đầy đủ thông tin bắt buộc");
                    else
                        alert("You must...");
                }
                else {
                    var url = "/api/PublicAPI/SendFeedback?name=" + vname + "&phone=" + vphone + "&add=" + vadd + "&nuoc=" + vnuoc + "&tinh=" + vtinh + "&message=" + vmess + "&email=" + vmail + "&title=" + vtitle + "&lang=" + lang;
                    $.ajax({
                        url: url
                    }).done(function (data) {
                        if (lang == "vn") {
                            if (data = "ok") {
                                alert("Gửi thành công, pntech.com.vn sẽ trả lời email cho bạn trong thời gian sớm nhất!");
                            }
                            else {
                                alert("Gửi bị lỗi, vui lòng thử lại!");
                            }
                        }
                        else {
                            if (data = "ok") {
                                alert("Sending success, pntech.com.vn will repy for you soon!");
                            }
                            else {
                                alert("Sending error, please try again!");
                            }
                        }
                    });
                }
            }

        });
    });
</script>